@use "../../../variables.scss" as *;
@use "../fonts.scss" as *;

// .sps-matrixdynamic__drag-element {
//   padding: calcSize(2);

//   &:hover {
//     background-color: $background;
//   }

//   &:after {
//     content: " ";
//     display: block;
//     height: calcSize(0.5);
//   }
// }

.sps-drag-element__svg {
  box-sizing: content-box;
  width: var(--sjs2-size-icon-medium, 24px);
  height: var(--sjs2-size-icon-medium, 24px);
  display: flex;
  padding: var(--sjs2-spacing-x100, 8px);
  padding-right: 0;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  use {
    fill: var(--sjs2-color-fg-basic-tertiary, rgba(from #1c1b20 r g b / 0.4));
  }
}

.sps-matrixdynamic__drag-drop-ghost-position-top,
.sps-matrixdynamic__drag-drop-ghost-position-bottom {
  position: relative;
}

.sps-matrixdynamic__drag-drop-ghost-position-top::after,
.sps-matrixdynamic__drag-drop-ghost-position-bottom::after {
  content: "";
  width: 100%;
  height: calcSize(0.5);
  background-color: var(--sjs-secondary-background-500, #19b394ff);
  position: absolute;
  left: 0;
}

.sps-matrixdynamic__drag-drop-ghost-position-top::after {
  top: 0;
}

.sps-matrixdynamic__drag-drop-ghost-position-bottom::after {
  bottom: 0;
}

.sps-question--matrixdynamic {
  display: flex;
  flex-direction: column;
  flex-grow: 1;

  .sps-question__title  {
    padding: 0;
    line-height: var(--sjs2-typography-line-height-default, 24px); /* 150% */
    color: var(--sjs2-color-fg-basic-primary, #1c1b20);
    @include sjs2--typography--default-strong;
  }
}

.sps-matrixdynamic__content {
  padding: var(--sjs2-spacing-x150, 12px);
  &,
  & > div {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }
  .sps-question__description--under {
    flex-grow: 0;
  }
}
.sps-table__row--detail .sps-matrixdynamic__content {
  padding: 0;
}
.sps-matrixdynamic__placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--ctr-property-grid-background-color, var(--sjs-layer-1-background-500, #ffffffff));
  border: 1px solid var(--ctr-survey-placeholder-border-color, var(--sjs-border-25, #d4d4d4ff));
  border-radius: var(--ctr-data-table-placeholder-corner-radius, var(--sjs-corner-radius-x075));
  box-sizing: border-box;
  padding: var(--ctr-data-table-placeholder-padding-top, var(--sjs-spacing-x6))
    var(--ctr-data-table-placeholder-padding-right, var(--sjs-spacing-x8))
    var(--ctr-data-table-placeholder-padding-bottom, var(--sjs-spacing-x6))
    var(--ctr-data-table-placeholder-padding-left, var(--sjs-spacing-x8));
  gap: var(--ctr-survey-placeholder-gap, var(--lbr-spacing-x05));

  .sps-matrixdynamic__add-btn {
    display: initial;
    margin: 0;
  }
}

.sps-matrixdynamic__placeholder-text {
  @include ctrDefaultFont;
  color: var(--ctr-survey-placeholder-text-color, var(--sjs-layer-1-foreground-50, #00000080));
  text-align: center;
}

.sps-matrixdynamic__row-icon {
  width: var(--sjs2-size-icon-medium, 24px);
  height: var(--sjs2-size-icon-medium, 24px);
  padding: 0;
  margin: var(--ctr-actionbar-button-padding-top-large-icon, var(--sjs-spacing-x1)) 0
    var(--ctr-actionbar-button-padding-bottom-large-icon, var(--sjs-spacing-x1)) 0;
  margin-left: var(--sjs2-spacing-x150, 12px);
  &:disabled {
    opacity: 1;
    use {
      fill: var(--sjs2-color-fg-brand-primary, #19b394);
    }
  }
}

.sps-matrixdynamic__footer {
  margin: 0 calc(-1 * var(--sjs2-spacing-x150, 12px)) var(--sjs2-spacing-x150, 12px);
  padding: 0 var(--sjs2-spacing-x150, 12px) var(--sjs2-spacing-x150, 12px);
  border-bottom: var(--sjs2-border-width-x100, 1px) solid var(--sjs2-color-border-basic-secondary, #d4d4d4);
  display: flex;
}
.sps-table-wrapper, sv-ng-matrix-table {
  &~ .sps-matrixdynamic__footer {
    border-bottom: none;
    margin-bottom: 0;
    padding-top: var(--sjs2-spacing-x075, 6px);
    padding-bottom: var(--sjs2-spacing-x050, 4px);
    display: flex;
    justify-content: stretch;
  }
}
.sps-matrixdynamic__add-btn {
  @include sjs2--typography--default;
  //display: none;
  appearance: none;
  border: none;
  background: var(--sjs2-color-bg-neutral-secondary, rgba(95, 94, 97, 0.1));
  color: var(--sjs2-color-fg-basic-primary, #1c1b20);
  text-align: center;
  flex-grow: 1;
  &:hover {
    background: var(--sjs2-color-bg-neutral-secondary-dim, rgba(95, 94, 97, 0.1));
  }
}

.sps-matrixdynamic__add-btn--icon {
  flex-direction: row-reverse;
  background: transparent;
  padding: var(--sjs2-spacing-x100, 8px);
  justify-content: flex-end;
  .sv-string-viewer {
    padding: 0 0 0 var(--sjs2-spacing-x100, 8px);
  }
}

.sps-matrixdynamic__add-btn-icon {
  display: flex;
  svg {
    width: 24px;
    height: 24px;
    fill: var(--sjs2-color-fg-basic-primary-muted, #424146);
  }
}

.sps-smiley-icon {
  width: calcSize(3);
  height: calcSize(3);
  margin: calcSize(1);
  border-radius: 100px;
  border: 1px solid var(--ctr-actionbar-button-icon-color, var(--sjs-layer-1-foreground-75, #000000bf));
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: calcSize(4);

  svg {
    width: calcSize(1.5);
    height: calcSize(1.5);
    fill: var(--ctr-actionbar-button-icon-color, var(--sjs-layer-1-foreground-75, #000000bf));
  }
}

.sps-question--matrixdynamic.sps-question--nested {
  .sps-question__header {
    padding: var(--sjs2-spacing-x200, 16px) var(--sjs2-spacing-x250, 20px) var(--sjs2-spacing-x100, 8px)
      var(--sjs2-spacing-x250, 20px);
    border-bottom: var(--sjs2-border-width-x100, 1px) solid var(--sjs2-color-border-basic-secondary, #d4d4d4);
    box-sizing: border-box;
  }
}

.sps-matrixdynamic__dragged-row {
  cursor: grabbing;
  position: absolute;
  z-index: 10000;

  .sps-table__row {
    display: flex;
    align-items: center;
    flex: 1 0 0;
    border-radius: var(--ctr-data-table-row-corner-radius-floating, var(--sjs-corner-radius-x05));
    background: var(--ctr-data-table-row-background-color, var(--sjs-layer-1-background-500, #ffffffff));
    box-shadow:
      var(--ctr-data-table-row-shadow-floating-1-offset-x, 0px)
        var(--ctr-data-table-row-shadow-floating-1-offset-y, 2px) var(--ctr-data-table-row-shadow-floating-1-blur, 8px)
        var(--ctr-data-table-row-shadow-floating-1-spread, 0px)
        var(--ctr-data-table-row-shadow-floating-1-color, var(--sjs-special-glow, #004c441a)),
      var(--ctr-data-table-row-shadow-floating-2-offset-x, 0px)
        var(--ctr-data-table-row-shadow-floating-2-offset-y, 16px)
        var(--ctr-data-table-row-shadow-floating-2-blur, 32px) var(--ctr-data-table-row-shadow-floating-2-spread, 0px)
        var(--ctr-data-table-row-shadow-floating-2-color, var(--sjs-special-glow, #004c441a));
  }
}
